﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Autocentro.Entities;

namespace Autocentro.Respository.Mapping
{
    public class ClienteMap:EntityTypeConfiguration<CLIENTE>
    {
        public ClienteMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            this.Property(c => c.Ruc_DNI)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(c => c.RazonSocial_Nombre)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(c => c.Telefono)
                .IsOptional()
                .HasMaxLength(11);

            this.Property(c => c.Direccion)
                .IsOptional()
                .HasMaxLength(100);

            this.Property(c => c.TipoCliente)
                .IsRequired()
                .HasMaxLength(15);

            this.ToTable("CLIENTE");
            this.Property(c => c.Id).HasColumnName("Id");
            this.Property(c => c.Ruc_DNI).HasColumnName("Ruc_DNI");
            this.Property(c => c.RazonSocial_Nombre).HasColumnName("RazonSocialNombre");
            this.Property(c => c.Telefono).HasColumnName("Telefono");
            this.Property(c => c.Direccion).HasColumnName("Direccion");
            this.Property(c => c.TipoCliente).HasColumnName("TipoCliente");
        }
    }
}
